package fic.storefinder.server.updateservice.robe;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.TreeMap;

import fic.storefinder.server.db.RobeTable;
import fic.storefinder.server.updateservice.ServiceInterface;
import fic.storefinder.shared.utils.Constants;

public abstract class GetRobeService implements ServiceInterface {

	protected HashMap<String, Object> parameters;
	

	@Override
	public void setParameters(HashMap<String, Object> parameters) {
		// TODO Auto-generated method stub
		this.parameters = parameters;
	}
	
	@Override
	public String generateResponse() throws Exception {
		RobeTable robeTable = new RobeTable();
		
		TreeMap<String, Object> responseMap = new TreeMap<String, Object>();
		ArrayList<HashMap<String, Object>> robes = robeTable.getRobesToUpdate((Long)parameters.get(Constants.REQUEST_PARAMETER_LAST_UPDATE_TIMESTAMP));
		responseMap.put(Constants.JSON_KEY_RESPONSE, robes);
		return formatResponse(responseMap);
	}

}
